package com.wang.controller;


import com.wang.base.http.RestResponse;
import com.wang.domain.TonguePicItem;
import com.wang.service.TonguePicItemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author WangZai
 * @since 2023-04-27
 */
@CrossOrigin
@RestController
@RequestMapping("/td/api/tonguePicItem")
@Api(tags = "舌诊图片模块接口说明")
public class TonguePicItemController {
    private final ModelMapper modelMapper;

    private final TonguePicItemService tonguePicItemService;

    @Autowired
    public TonguePicItemController(ModelMapper modelMapper, TonguePicItemService tonguePicItemService) {
        this.modelMapper = modelMapper;
        this.tonguePicItemService = tonguePicItemService;
    }


    @Transactional(rollbackFor = Exception.class)
    @GetMapping(value = "/selectDiagnosisPicItems/{tonguePicItemId}")
    @ApiOperation("查询图片结果接口")
    public RestResponse<Object> selectDiagnosisPicItems(@PathVariable(value="tonguePicItemId") Integer tonguePicItemId){
        TonguePicItem tonguePicItem = tonguePicItemService.getTonguePicItemById(tonguePicItemId);
        if(tonguePicItem!=null){
            return RestResponse.ok(tonguePicItem);
        }else{
            return RestResponse.failure("查询失败！！！");
        }
    }
}

